package com.huike.business.service.impl;


import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.mapper.TbBusinessMapper;
import com.huike.business.mapper.TbBusinessTrackRecordMapper;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.clues.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 商机跟进记录Service业务层处理
 *
 * @author wgl
 * @date 2021-04-28
 */
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {
    @Autowired
    private TbBusinessMapper tbBusinessMapper;

    @Autowired
    private TbBusinessTrackRecordMapper tbBusinessTrackRecordMapper;

    @Autowired
    private ISysDictDataService sysDictDataService;



    //新增商机跟进记录
    @Override
    @Transactional
    public void insert(TbBusinessTrackRecord tbBusinessTrackRecord, TbBusiness tbBusiness) {
        //1. 向商机跟进记录表保存记录
        tbBusinessTrackRecordMapper.insert(tbBusinessTrackRecord);

        //2. 向商机表更新数据(已经提供)
        tbBusinessMapper.updateTbBusiness(tbBusiness);
    }

    //查询商机跟进记录列表
    @Override
    public List<TbBusinessTrackRecord> findListByBusinessId(Long businessId) {
        // 查询跟进记录列表
        return tbBusinessTrackRecordMapper.findListByBusinessId(businessId);
    }

}
